package com.dlw.factoryDemo;

/**
 * 模拟客户端实现
 */
public class DlwTest {
    public static void main(String[] args) {

        //普通调用
//        HairInterface left = new LeftHair();
//        left.draw();

        //工厂模式关键字调用
        HairFactory factory = new HairFactory();
//        HairInterface left = factory.getHair("left");
//        left.draw();

        //工厂模式类名调用
//        HairInterface left = factory.getHairByClass("com.dlw.factoryDemo.LeftHair");
//        left.draw();

        //工厂模式使用.properties文件中的字符串定义类名优化上一种方法
        HairInterface hair = factory.getHairByClassKey("in");
        hair.draw();

        //抽象工厂模式
        PersonFactory McGirlFactory = new McFactory();
        Girl girl = McGirlFactory.getGirl();
        girl.drawWomen();

        PersonFactory HnBoyFactory = new HnFactory();
        Boy boy = HnBoyFactory.getBoy();
        boy.drawMan();
    }
}
